#region Using Statements
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
#endregion

namespace GameBase.Graphics
{
    /// <summary>
    /// Describes a custom vertex format structure that contains position, normal, tangent and binormal data, and one set of texture coordinates.
    /// </summary>
    public struct VertexPositionNormalTangentBinormalTexture : IVertexType
    {
        /// <summary>
        /// XYZ position.
        /// </summary>
        public Vector3 Position;
        /// <summary>
        /// XYZ surface normal.
        /// </summary>
        public Vector3 Normal;
        /// <summary>
        /// XYZ surface tangent.
        /// </summary>
        public Vector3 Tanget;
        /// <summary>
        /// XYZ surface binormal.
        /// </summary>
        public Vector3 Binormal;
        /// <summary>
        /// UV texture coordinates.
        /// </summary>
        public Vector2 TextureCoordinate;

        /// <summary>
        /// Vertex declaration, which defines per-vertex data.
        /// </summary>
        public readonly static VertexDeclaration VertexDeclaration = new VertexDeclaration
        (
            new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
            new VertexElement(12, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0),
            new VertexElement(24, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0),
            new VertexElement(32, VertexElementFormat.Vector3, VertexElementUsage.Tangent, 0),
            new VertexElement(44, VertexElementFormat.Vector3, VertexElementUsage.Binormal, 0)
        );

        /// <summary>
        /// Initializes a new instance of this struct.
        /// </summary>
        /// <param name="pos">The vertex position.</param>
        /// <param name="normal">The vertex normal.</param>        
        /// <param name="tangent">The vertex tangent.</param>
        /// <param name="binormal">The vertex binormal.</param>
        /// /// <param name="textureCoordinate">The texture coordinate.</param>
        public VertexPositionNormalTangentBinormalTexture(Vector3 pos, Vector3 normal, Vector3 tangent,
                                                          Vector3 binormal, Vector2 textureCoordinate)
        {
            Position = pos;
            Normal = normal;
            TextureCoordinate = textureCoordinate;
            Tanget = tangent;
            Binormal = binormal;
        }

        VertexDeclaration IVertexType.VertexDeclaration
        {
            get { return VertexDeclaration; }
        }
    }
}


